load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "errormanager",
    srcs = ["errormanager.go"],
    importpath = "github.com/pingcap/tidb/br/pkg/lightning/errormanager",
    visibility = ["//visibility:public"],
    deps = [
        "//br/pkg/lightning/backend/encode",
        "//br/pkg/lightning/backend/kv",
        "//br/pkg/lightning/common",
        "//br/pkg/lightning/config",
        "//br/pkg/lightning/log",
        "//br/pkg/logutil",
        "//br/pkg/redact",
        "//br/pkg/utils",
        "//parser/mysql",
        "//table",
        "//table/tables",
        "//tablecodec",
        "@com_github_jedib0t_go_pretty_v6//table",
        "@com_github_jedib0t_go_pretty_v6//text",
        "@com_github_pingcap_errors//:errors",
        "@com_github_tikv_client_go_v2//error",
        "@org_golang_x_sync//errgroup",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_multierr//:multierr",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "errormanager_test",
    timeout = "short",
    srcs = ["errormanager_test.go"],
    embed = [":errormanager"],
    flaky = True,
    shard_count = 5,
    deps = [
        "//br/pkg/lightning/backend/kv",
        "//br/pkg/lightning/config",
        "//br/pkg/lightning/log",
        "//br/pkg/utils",
        "//parser/model",
        "//parser/mysql",
        "//table/tables",
        "//types",
        "@com_github_data_dog_go_sqlmock//:go-sqlmock",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_atomic//:atomic",
    ],
)
